Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add options to apply formatting by file extension, file syntax, or both #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

owenleonard
Copy link

I saw issue 69 (#69) and it related to something I was trying to figure out. I like the formatting that jsbeautify does for javascript, but not for JSON. I just find it expands things too much. So, I wanted to be able to continue using jsFormat for javascript files, but not for JSON files.

Since issue 69 also wanted to exclude js.erb files from being formatted, I thought a good solution would be to allow the user to configure jsFormat to format files based on file extension, file syntax, or both. This way, you can enable/disable jsFormat for a file extension regardless of the content of the file, or you can configure it to format based on file syntax regardless of the file extension. The defaults leave the functionality the same as before the changes.

Let me know what you think about these changes. Any recommendations? Optimizations?

@jdavisclark
Copy link
Owner

looks good.
As soon as we get #79 finished up I'll merge this in.

@owenleonard
Copy link
Author

Thanks. Let me know if I can do anything to help.

@jdavisclark
Copy link
Owner

Promise I haven't forgotten this. I branched off from your pull request and added some more functionality to it; haven't pushed up to a feature branch yet though. Trying to make sure It's well though out before we publish, as it's the type of thing where I keep thinking of more little details that are convenient to make configurable via user settings.

I'll push up to a feature branch some time this week so people can have a look at it.

@jdavisclark
Copy link
Owner

@owenleonard Alright, I know this is ridiculously late, but have a look at the changes in the plugin_activation branch. I took what you started with and added a few more options to it. Welcoming any feedback.

@jackocnr
Copy link

Hi @jdc0589 did this ever get merged in? Are you still waiting for feedback? If so, how would I go about installing JsFormat from that specific branch?

Thanks for your work on this.

@jdavisclark
Copy link
Owner

@jackocnr it's not merged in yet, mainly because I've been a bad project maintainer lately and forgot about it. mite-node has been taking up a lot of my free time lately...

There have been a few additions in master since the work on that branch, but you could install from the plugin_activation branch if you want to have a look at it, I would certainly appreciate any feedback.

To install that branch, remove the existing JsFormat package, navigate to [Sublime Root]/Packages, git clone this repo there, and then fetch + checkout the plugin_activation branch. Then have a look at the documentation for the new jsFormat specific settings in that branch.

I need to review it all, but it looks like it can still be merged to master relatively easily. I'll try and get it in soon.

@ctf0
Copy link

ctf0 commented Oct 1, 2014

as a temp solution for ignoring json formatting ,u can use a plugin call Hook and add this to ur user settings file

"on_pre_save_language": [
                    {
                        "command": "js_format",
                        "context": [{"key": "selector", "operator": "equal", "operand": "source.js"}]
                    },
                ]

but to say the least ,the plugin_activation branch has some ridiculously awesome options which i hope it get merged sometime soon.

@kurtextrem
Copy link

Any news? This feature would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants